package cn.zcx;

import java.util.concurrent.CountDownLatch;

/**
 * description:原子操作
 * author:zcx
 * lenovo
 * 时间：2022.02.08.09.00
 */
public class T25 {
   static int i=0;
   static   CountDownLatch latch=new CountDownLatch(4);
    public static void main(String[] args) {
        var t=new T25();
        new Thread(t::add,"T1").start();
        new Thread(t::add,"T2").start();
        new Thread(t::add,"T3").start();
        new Thread(t::add,"T4").start();
        try {
            latch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        new Thread(()->{

        }).start();
    }
    void add(){
        for (int i = 0; i < 10; i++) {
            i++;
        }
    }
}
